import string

class Card:
    def __init__(self,suit,rank):
        self.suit = suit
        self.rank = rank
        suitList = []
        rankList = []

    def __repr__(self):
        return str(self)

    def __str__(self):
        return "%s of %s" % (self.rankList[self.rank],self.suitList[self.suit])

    class Deck():
        def __init__(self):
            self.cards = []
        for suit in range(4):
            for rank in range(1,14):
                self.cards.append(Card(suit,rank))

    def printDeck(self):
        for card in self.cards:
            print card

    def __str__(self):
        s = ""
        for i in range(len(self.cards)):
            s = s + " " + str(self.cards[i]) + '\n'
            return s

    def shuffle(self):
        import random
        nCards = len(self.cards)
        for i in range(nCards):
            j = random.randrange(i, nCards)
            [self.cards[i], self.cards[j]] = [self.cards[j], self.cards[i]]

    def main():
        a = open('cards.txt','r')
        line = a.readlines()
        a.close()

deck = Deck()

cards =[]
for i in line:
    cards.append(i.split())

print deck

for index, suit in enumerate(Card.suitList):
    if suit == 'h':
        Card.suitList[index] = "Hearts"
    elif suit == 'c':
        Card.suitList[index] = "Clubs"
    elif suit == 's':
        Card.suitList[index] = "Spades"
    elif suit == 'd':
        Card.suitList[index] = "Diamonds"
